package com.zzw.spring.quartz;

import org.quartz.*;
import org.quartz.impl.JobDetailImpl;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.impl.triggers.SimpleTriggerImpl;

import java.util.Date;

public class SimpleTrigerRunner {

    public static void main(String[] args) throws SchedulerException {
        JobDetail jobDetail = new JobDetailImpl("job1_1","jgroup1",SimpleJob.class);
        SimpleTriggerImpl simpleTrigger = new SimpleTriggerImpl("trigger1_1","tgroup1");
        simpleTrigger.setStartTime(new Date());
        simpleTrigger.setRepeatInterval(2000);
        simpleTrigger.setRepeatCount(100);
        SchedulerFactory schedulerFactory = new StdSchedulerFactory();
        Scheduler scheduler = schedulerFactory.getScheduler();
        scheduler.scheduleJob(jobDetail,simpleTrigger);
        scheduler.start();
    }
}
